package com.suvel.controller;

import com.suvel.study.pojo.Resume;
import com.suvel.study.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/resume")
public class ResumeController {

    @Autowired
    private ResumeService resumeService;

    @Value("${server.port}")
    private Integer port;

    @GetMapping("/openstate/{userId}")
    public Integer fingDefaultResumeState(@PathVariable Long userId){
        Integer isOpenResume = 0;
        Resume resume = resumeService.findDefaultResumeByUserId(userId);
        if(resume != null){
            isOpenResume = resume.getIsOpenResume();
        }

        System.out.println("被调用-----------------------");
        return port;
    }

}
